﻿package mortal.game.view.lotteryDraw
{
    import Message.DB.Tables.*;
    import com.mui.controls.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.*;

    public class lotteryExchangeCategoryCellRender extends GCellRenderer
    {
        private var _categoryBgSelect:GImageBitmap;
        private var _categoryData:LotteryExchangeCategoryData;
        private var _selectSkin:GImageBitmap;

        public function lotteryExchangeCategoryCellRender()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._selectSkin = UIFactory.gImageBitmap(ImagesConst.ShopSelectBg, 0, 0, this);
            this._selectSkin.visible = false;
            this._categoryBgSelect = UIFactory.gImageBitmap("", 0, 10, this, this.updatePos);
            return;
        }// end function

        override public function set selected(param1:Boolean) : void
        {
            super.selected = param1;
            if (param1)
            {
                this._selectSkin.visible = true;
            }
            else
            {
                this._selectSkin.visible = false;
            }
            return;
        }// end function

        private function updatePos() : void
        {
            if (this.isDisposed)
            {
                return;
            }
            this._categoryBgSelect.x = (104 - this._categoryBgSelect.width) * 0.5;
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:TShop = null;
            super.data = param1;
            this._categoryData = param1 as LotteryExchangeCategoryData;
            if (this._categoryData)
            {
                _loc_2 = ShopConfig.instance.getTShopByCode(this._categoryData.shopCode);
                this._categoryBgSelect.imgUrl = "shopGroupTab_" + _loc_2.unit + ".png";
                this._categoryBgSelect.x = 0;
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._categoryBgSelect.dispose(param1);
            this._selectSkin.dispose(param1);
            this._categoryBgSelect = null;
            this._selectSkin = null;
            this._categoryData = null;
            super.disposeImpl(param1);
            return;
        }// end function

    }
}
